package com.sfzy.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.sfzy.entity.Search;
import com.sfzy.mapper.SearchMapper;
import com.sfzy.service.SearchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SearchServiceImpl implements SearchService {
    @Autowired
    private SearchMapper searchMapper;



    @Override
    public int addSearch(Search search) {
        return searchMapper.addSearch(search);
    }

    @Override
    public int deleteSearch(int id) {
        return searchMapper.deleteSearch(id);
    }

    @Override
    public int updateSearch(Search search) {
        return searchMapper.updateSearch(search);
    }

    @Override
    public Search getById(int id) {
        return searchMapper.getById(id);
    }

    @Override
    public PageInfo<Search> getByPage(Search search, int pageNum, int pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        List<Search> list = searchMapper.getByPage(search);
        PageInfo<Search> pageInfo = new PageInfo<>(list);
        return pageInfo;
    }
}
